package com.kcht.itsed.mws.alespecadapter.biz;

import com.kcht.itsed.mws.alespecadapter.facade.IMwsPluginRegister;
import com.kcht.itsed.mws.commmodel.TMDatatypeFormatTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Arrays;

/**
 * 原生规则插件加载器
 * @author 张文硕
 *
 */
@Component
public class NativeSpecPluginLoader {
	
	@Autowired
	private IMwsPluginRegister mwsPluginRegister;
	
	@PostConstruct
	public void loadNativeSpecPlugin(){
		mwsPluginRegister.registerTagDecoder("epc", "epc数据类型", NativeEpcDecoder.class,new TMDatatypeFormatTemplate(){{
			setFormats(Arrays.asList(new String[]{"epc-pure","epc-tag","epc-hex","epc-decimal"}));
		}});
		mwsPluginRegister.registerTagDecoder("uint", "无符号整形", UintTagDecoder.class,new TMDatatypeFormatTemplate(){{
			setFormats(Arrays.asList(new String[]{"hex","decimal"}));
		}});
		
		mwsPluginRegister.registerReaderMapper("原始阅读器","报告中直接记录阅读器信息",RawReaderMapping.class);
	}
	
}
